import { Controller, ExecutionContext, SetMetadata, applyDecorators, createParamDecorator } from "@nestjs/common";
import { Request } from "express";

export const TestMergeDecorator = createParamDecorator(
    (data: string, ctx: ExecutionContext) => {
        const request: Request = ctx.switchToHttp().getRequest()
        return data ? request.headers[data.toLowerCase()] : request.headers
    }
)

export const Ddd  = () => Controller('ddd')

export const MergeTest = (path, metadata) => {
    return applyDecorators(
        Controller(path),
        SetMetadata('abin', metadata)
    )
}